package com.fenglingzff.reportstudent.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fenglingzff.reportstudent.common.Result;
import com.fenglingzff.reportstudent.entity.Techuser;
import com.fenglingzff.reportstudent.service.TechuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zzp
 * @since 2024-08-29
 */
@RestController
@RequestMapping("/techuser")
public class TechuserController {
    @Autowired
    TechuserService techuserService;

    @PostMapping("/login")
    public Result login(@RequestBody Techuser techuser){
        List<Techuser> list = techuserService.lambdaQuery()
                .eq(Techuser::getUsername, techuser.getUsername())
                .eq(Techuser::getPassword, techuser.getPassword())
                .list();
        return list.size()>0?Result.success(list.get(0)):Result.fail();
    }
}
